<style>
    .form-signin {
        max-width: 330px;
        padding: 15px;
        margin: 0 auto;
    }
    .form-signin .form-signin-heading,
    .form-signin .checkbox {
        margin-bottom: 10px;
    }
    .form-signin .checkbox {
        font-weight: normal;
    }
    .form-signin .form-control {
        position: relative;
        height: auto;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        padding: 10px;
        font-size: 16px;
    }
    .form-signin .form-control:focus {
        z-index: 2;
    }
    .form-signin input[type="email"] {
        margin-bottom: -1px;
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
    }
    .form-signin input[type="password"] {
        margin-bottom: 10px;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }
#ajax-loaderdiv {position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 35000;background-color: rgba(0, 0, 0, 0.3);display: none;}
.ajax-loader {position: absolute;left: 50%;top: 50%;margin-left: -16px;margin-top: -16px;display: block;}
</style>
<div id="ajax-loaderdiv" style="display: none;">
    <img src="/billyn-dev/images/ajax-loader.gif" class="ajax-loader">
</div>
<?php
/*
$space = Blyn::app()->getActiveSpace();
$apps = $space->getApps();
$roleData = array();
foreach ($apps as $app) {
    if ($app instanceof BApp) {
        $roles = $app->getRoles();
        if ($roles != NULL){
        foreach ($roles as $id => $role) {
            $roleData[$id] = $app->getName() . '|' . $role->getName();
        }
        }
    }
}
 
$user = Blyn::app()->getCurrentUser();
 * 
 */
$membershipControl = new BUIMembership();
$roleData = $membershipControl->getUserAllowApplyRoles();

$model = new BDynamicFormModel();
$roleField = 'media_roleId_membership';
$model->addField($roleField);
?>

<div class="container">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        "id" => "manage-myInfo-form",
        'enableAjaxValidation' => FALSE,
        'htmlOptions' => array('class' => 'form-signin', 'role' => 'form'),
    ));
    ?>
    <legend><h3 class="form-signin-heading text-muted">申请会员</h3></legend>

    <div class="displayUserInfo">
        <?php
        if (isset($applyResult)) {
            if ($applyResult == 'fail') {
                ?>
                <p class="bg-warning">
                    <strong>opps....apply for member fail!.</strong>
                </p>
                <?php
            } else {
                ?>
                <p class="bg-success">
                    <strong>Yeah, apply status:<?php echo $applyResult; ?></strong>
                </p>
                <?php
            }
        }
        ?>
        <h5>选择申请的角色：</h5>
        <?php echo CHtml::activeRadioButtonList($model, $roleField, $roleData); ?>
        <?php
        echo $control->getAjaxLink(array('name' => '申请加入', 'id' => BUIMembership::Submit_Apply), array('htmlOptions' => array(
                'class' => 'btn btn-success btn-lg btn-block'
        )));
        ?>   
        <?php
        echo $control->getAjaxLink(array('name' => '会员资格', 'id' => BUIMembership::Show_User_Membership), array('htmlOptions' => array(
                'class' => 'btn btn-info btn-lg btn-block'
        )));
        ?>
    </div>
    <?php $this->endWidget(); ?>
</div>
